// -----------------------------
// Author: 		Dhaenens Gert 
// Creation: 	11/24/2014 1:21:01 PM				
// -----------------------------

#ifndef _Thread_h
#define _Thread_h

#include "Common.h"

class Thread
{
public:
	typedef void(*ThreadCallback)(Thread*, void*);

	Thread();
	~Thread();

	Bool	Start(ThreadCallback fnThreadCallback, void* lpArgs);
	Bool	Stop();
	Bool	Suspend();
	Bool	Resume();

	Bool			IsRunning() const;
	Bool			IsSuspended() const;
	ThreadCallback	GetCallback() const;

private:

	static DWORD WINAPI ThreadProc(void* lpParam);
	struct ThreadArgs
	{
		Thread* Thread;
		void*	lpArgs;
	};

	DWORD			m_dwThreadId;
	HANDLE			m_hThread;
	Bool			m_bIsRunning;
	Bool			m_bIsSuspended;
	ThreadCallback	m_fnCallback;
	ThreadArgs		m_Args;

	Thread(const Thread& refThread);
	Thread& operator=(const Thread& refThread);
};

#endif